﻿namespace LanSunERP
{
    using System;
    using System.ServiceModel;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Runtime.Serialization;
    using System.Collections;
    using System.Data;
    using System.Data.SqlClient;

    public class CustomerMasterData:QueryCommand
    {
             public CustomerMasterData() : base () { }
             public CustomerMasterData(SqlCommand cmdSQL, DataTable dtRequest,string RequestJob)
         : base(cmdSQL, dtRequest,RequestJob) {  }
        public SqlCommand BuildCommand()
        {
           switch (RequestJob.Substring(6, 10))
            {
                case "0000": break;
                case "1000": break;
                case "1001":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@CompanyFullName", dwRequest["CompanyFullName"].ToString()));
                    break;
                case "1002": break;
                case "2000": 
                case "3000":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString()));
                    cmdSQL = BuildInstanceKey(cmdSQL, dwRequest);
                    cmdSQL.Parameters.Add(new SqlParameter("@LongDescription", dwRequest["LongDescription"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ShortDescription", dwRequest["ShortDescription"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@CompanyFullName", dwRequest["CompanyFullName"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@CompanyShortName", dwRequest["CompanyShortName"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ContactTitle", dwRequest["ContactTitle"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ContactName", dwRequest["ContactName"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@PostalCode", dwRequest["PostalCode"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Address", dwRequest["Address"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Country", dwRequest["Country"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Province", dwRequest["Province"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@City", dwRequest["City"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Credit", dwRequest["Credit"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ID", dwRequest["ID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Region", dwRequest["Region"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Phone", dwRequest["Phone"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Fax", dwRequest["Fax"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@SubStatus", dwRequest["SubStatus"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Status", dwRequest["Status"].ToString()));
                    
                    break;
                case "2001":case "4000":
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString()));
                    break;

            }
             return cmdSQL;

        }      

    }
}